package com.scilvet.reportcomposer.node;

import com.scilvet.reportcomposer.account.AccountID;
import com.scilvet.reportcomposer.account.AccountStore;
import com.scilvet.reportcomposer.account.Amount;
import com.scilvet.reportcomposer.account.AmountType;

public class AccountNode implements Node {
	
	private static AccountStore accountStore = null;
	private AccountID accountID;
	private AmountType amountType;
	
	public AccountNode(AccountID account, AmountType amountType) {
		
		this.accountID = account;
		this.amountType = amountType;
	}
	
	public static void setAccountStore(AccountStore accountStore) {
		
		AccountNode.accountStore = accountStore;
	}

	@Override
	public Amount getValue() {
		
		return accountStore.getAccountValue(accountID, amountType);
	}
	
	@Override
	public String toString() {

		return amountType + accountID.toString();
	}
	
	public String printValues() {
		return accountStore.getAccountValue(accountID, amountType).toString();
	}
}